function r(r) {
    var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
    if ((r = String(r).toLowerCase()) && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(r)) {
        if (4 === r.length) {
            for (var n = "#", e = 1; e < 4; e += 1) n += r.slice(e, e + 1).concat(r.slice(e, e + 1));
            r = n;
        }
        for (var o = [], a = 1; a < 7; a += 2) o.push(parseInt("0x".concat(r.slice(a, a + 2))));
        return t ? "rgb(".concat(o[0], ",").concat(o[1], ",").concat(o[2], ")") : o;
    }
    return /^(rgb|RGB)/.test(r) ? r.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",").map(function(r) {
        return Number(r);
    }) : r;
}

function t(r) {
    var t = r;
    if (/^(rgb|RGB)/.test(t)) {
        for (var n = t.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(","), e = "#", o = 0; o < n.length; o++) {
            var a = Number(n[o]).toString(16);
            "0" === (a = 1 == String(a).length ? "0".concat(a) : a) && (a += a), e += a;
        }
        return 7 !== e.length && (e = t), e;
    }
    if (!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)) return t;
    var c = t.replace(/#/, "").split("");
    if (6 === c.length) return t;
    if (3 === c.length) {
        for (var i = "#", f = 0; f < c.length; f += 1) i += c[f] + c[f];
        return i;
    }
}

exports.colorGradient = function() {
    for (var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "rgb(0, 0, 0)", e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "rgb(255, 255, 255)", o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 10, a = r(n, !1), c = a[0], i = a[1], f = a[2], g = r(e, !1), s = (g[0] - c) / o, l = (g[1] - i) / o, u = (g[2] - f) / o, h = [], v = 0; v < o; v++) {
        var p = t("rgb(".concat(Math.round(s * v + c), ",").concat(Math.round(l * v + i), ",").concat(Math.round(u * v + f), ")"));
        0 === v && (p = t(n)), v === o - 1 && (p = t(e)), h.push(p);
    }
    return h;
}, exports.colorToRgba = function(r, n) {
    r = t(r);
    var e = String(r).toLowerCase();
    if (e && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)) {
        if (4 === e.length) {
            for (var o = "#", a = 1; a < 4; a += 1) o += e.slice(a, a + 1).concat(e.slice(a, a + 1));
            e = o;
        }
        for (var c = [], i = 1; i < 7; i += 2) c.push(parseInt("0x".concat(e.slice(i, i + 2))));
        return "rgba(".concat(c.join(","), ",").concat(n, ")");
    }
    return e;
}, exports.hexToRgb = r, exports.rgbToHex = t;